<template>
  <div class="medical">
    <!-----头部----->
    <div class="medical_head">
        <div class="head_logo"><img src="../../../assets/img/med_logo.png"></div>
    </div>
    <!----导航------>
    <div class="medical_nav">
      <ul class="flex flex-space-around">
        <li v-for="(item,index) in navList" :class="[index == hindex ? 'on' : '']">
          <a v-if="item.id && item.name != '馆情介绍'" :href="item.href + '?catid=' + item.id" target="_blank">
            {{ item.name }}
          </a> 
          <a v-if="item.name == '馆情介绍' && item.id" :href="item.href + '?id=' + item.id" target="_blank">
            {{ item.name }}
          </a> 
          <a v-if="!item.id" :href="item.href" target="_blank">
            {{ item.name }}
          </a>                   
        </li>
      </ul>
    </div>

    <!---内容---->
    <div class="medical_main">
      <div class="medical_cont clearfix">
        <!----数字资源---->
        <div class="num_res fl">
          <div class="n_r_head">
            <span class="zh">数字资源</span>
            <span class="en">Digital Resources</span>
            <div class="bd"></div>
          </div>
          <ul>
            <li class="clearfix">
              <a href="http://192.168.8.103" target="_blank">
                <div class="tb fl"><img src="../../../assets/img/frame_3.png"></div>
                <div class="txt fr">
                  <h1>万方医药期刊全文数据库（含中华医学会期刊）</h1>
                  <p>《医药期刊全文数据库》以中国数字化期刊群为基础，整合了中国科技论文与引文数据库及其他相关数据库中...</p>
                </div>
              </a>
            </li>
            <li class="clearfix">
              <a href="http://192.168.8.100/kns55" target="_blank">
                <div class="tb fl"><img src="../../../assets/img/frame_2.png"></div>
                <div class="txt fr">
                  <h1>中国知网CHKD（中文全文数据库）</h1>
                  <p>CHKD期刊知识库选收录我国公开出版发行的医学专业期刊类、生物科学类、医院管理类、图书情报类、计...</p>
                </div>
              </a>
            </li>
            <li class="clearfix">
              <a href="http://192.168.101.153:801" target="_blank">
                <div class="tb fl"><img src="../../../assets/img/frame_1.png"></div>
                <div class="txt fr">
                  <h1>外文生物医学期刊全文数据库（更新至2021年止）</h1>
                  <p>该数据库(含871种期刊)采用数据挖掘和数据融合技术，整合世界几大知名出版社(Sciencedi...</p>
                </div>
              </a>
            </li>
          </ul>
        </div>

        <!----通知公告----->
        <div class="fr">
          <!----通知公告----->
          <div class="notice">
            <div class="notice_head clearfix">
              <span class="zh">通知公告</span>
              <span class="en">Notice</span>
              <div class="bd"></div>
              <div class="more fr">
                <a :href="'/list?catid=' + notice_id" target="_blank">
                  更多<i class="iconfont icon-xiangyou-tianchong"></i>
                </a>                
              </div>
            </div>
            <ul>
              <li v-for="item in notice_news">
                <a  v-if="item.returnurl && item.returnurl != ''" :href="item.returnurl" target="_blank">
                  <div class="cont flex flex-align-center">
                    <div class="time">
                      <p>{{item.addtime.slice(8,10)}}</p>
                      <p>{{item.addtime.slice(0,7)}}</p>
                    </div>
                    <div class="title wb2">{{item.infotitle}}</div>
                  </div>
                  <i class="iconfont icon-youxiasanjiao"></i>
                </a>
                <a v-else :href="'/article?id=' + item.infoid" target="_blank">
                  <div class="cont flex flex-align-center">
                    <div class="time">
                      <p>{{item.addtime.slice(8,10)}}</p>
                      <p>{{item.addtime.slice(0,7)}}</p>
                    </div>
                    <div class="title wb2">{{item.infotitle}}</div>
                  </div>
                  <i class="iconfont icon-youxiasanjiao"></i>
                </a>
              </li>
            </ul>
          </div>

          <!----培训动态----->
          <div class="train">
            <div class="notice_head clearfix">
              <span class="zh">培训动态</span>
              <span class="en">Training updates</span>
              <div class="bd"></div>
              <div class="more fr">
                <a :href="'/list?catid=' + study_id" target="_blank">
                  更多<i class="iconfont icon-xiangyou-tianchong"></i>
                </a>
              </div>
            </div>
            <ul>
              <li v-for="item in study_news">
                <a v-if="item.returnurl && item.returnurl != ''" :href="item.returnurl" target="_blank" class="flex flex-align-center ">
                  <i class="iconfont icon-yuandianxiao"></i>
                  <div class="title">{{item.infotitle}}</div>
                  <div class="time">{{item.addtime}}</div>
                </a>
                <a v-else :href="'/article?id=' + item.infoid" target="_blank" class="flex flex-align-center ">
                  <i class="iconfont icon-yuandianxiao"></i>
                  <div class="title">{{item.infotitle}}</div>
                  <div class="time">{{item.addtime}}</div>
                </a>  
              </li>
            </ul>
          </div>
        </div>
        

      </div>
    </div>
    <!-----底部----->
    <div class="medical_foot">
      <span>版权所有：东部战区总医院</span>
      <span>技术支持：博士后科研工作站</span>
    </div>
  </div>
</template>
<script setup name="medical">
import { getMenu } from "@/api/yxzx/menu";
import { leftCategorylist } from '@/api/yxzx/home'
import { listpassInfo } from "@/api/yxzx/info";
export default {
 components: {
 },
 data() {
   return {
       hindex: 0,
       navList:[
           {name: '首页', href:'/medical'},
           {name: '通知公告',id: '', href:'/list'},
           {name: '培训动态',id: '', href:'/list'},
           {name: '馆情介绍',id: '', href:'/article'},
           {name: '电子邮箱', href:'http://192.168.8.10/webpage/email/login.jsp'}
       ],
       notice_news: [], // 通知公告
       work_news: [], // 馆情介绍
       study_news: [], // 培训动态
       study_id: '',
       work_id: '',
       notice_id: '',
   }
 },
 computed: {},
 created() {
   this.getList()
 },
 methods: {
   /** 查询菜单列表 */
   getList() {
       this.loading = true;
       getMenu().then(response => {
         response.resultContent.map((item) => {
           if (item.categoryname == '医学信息网') {
             leftCategorylist(item.categoryid).then((res) => {
               res.map((el) =>{
                 if(el.categoryname == '通知公告'){
                   this.notice_id = el.categoryid
                   this.navList[1].id = el.categoryid
                   listpassInfo(el.categoryid, "", 1, 3).then((req) => {
                     this.notice_news = req.InfoList;
                   }); 
                 } else if (el.categoryname == '培训动态'){
                   this.study_id = el.categoryid
                   this.navList[2].id = el.categoryid
                   listpassInfo(el.categoryid, "", 1, 3).then((req) => {
                     this.study_news = req.InfoList;
                   }); 
                 } else if (el.categoryname == '馆情介绍'){
                   this.navList[3].id = el.infoid
                   listpassInfo(el.categoryid, "", 1, 1).then((req) => {
                     this.navList[3].id = req.InfoList[0].infoid
                   });
                 }
               })
             });            
           }
         })
         this.loading = false;
       })
   },
 }
} 
</script>